<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
  Module: KerbalStuff
  
    &mdash; Documentation by YARD 0.8.7.6
  
</title>

  <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />

  <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />

<script type="text/javascript" charset="utf-8">
  hasFrames = window.top.frames.main ? true : false;
  relpath = '';
  framesUrl = "frames.html#!KerbalStuff.html";
</script>


  <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>

  <script type="text/javascript" charset="utf-8" src="js/app.js"></script>


  </head>
  <body>
    <div id="header">
      <div id="menu">
  
    <a href="_index.html">Index (K)</a> &raquo;
    
    
    <span class="title">KerbalStuff</span>
  

  <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>

      <div id="search">
  
    <a class="full_list_link" id="class_list_link"
        href="class_list.html">
      Class List
    </a>
  
    <a class="full_list_link" id="method_list_link"
        href="method_list.html">
      Method List
    </a>
  
    <a class="full_list_link" id="file_list_link"
        href="file_list.html">
      File List
    </a>
  
</div>
      <div class="clear"></div>
    </div>

    <iframe id="search_frame"></iframe>

    <div id="content"><h1>Module: KerbalStuff
  
  
  
</h1>

<dl class="box">
  
  
    
  
    
  
  
  
    <dt class="r1 last">Defined in:</dt>
    <dd class="r1 last">lib/KerbalStuff.rb<span class="defines">,<br />
  lib/kerbalstuff/mod.rb,<br /> lib/kerbalstuff/user.rb,<br /> lib/kerbalstuff/auth.rb,<br /> lib/kerbalstuff/version.rb</span>
</dd>
  
</dl>
<div class="clear"></div>

<h2>Defined Under Namespace</h2>
<p class="children">
  
    
  
    
      <strong class="classes">Classes:</strong> <span class='object_link'><a href="KerbalStuff/Auth.html" title="KerbalStuff::Auth (class)">Auth</a></span>, <span class='object_link'><a href="KerbalStuff/ErrorException.html" title="KerbalStuff::ErrorException (class)">ErrorException</a></span>, <span class='object_link'><a href="KerbalStuff/LoginException.html" title="KerbalStuff::LoginException (class)">LoginException</a></span>, <span class='object_link'><a href="KerbalStuff/Mod.html" title="KerbalStuff::Mod (class)">Mod</a></span>, <span class='object_link'><a href="KerbalStuff/ModVersion.html" title="KerbalStuff::ModVersion (class)">ModVersion</a></span>, <span class='object_link'><a href="KerbalStuff/NotLoggedInException.html" title="KerbalStuff::NotLoggedInException (class)">NotLoggedInException</a></span>, <span class='object_link'><a href="KerbalStuff/User.html" title="KerbalStuff::User (class)">User</a></span>
    
  
</p>

  <h2>Constant Summary</h2>
  
    <dl class="constants">
      
        <dt id="VERSION-constant" class="">VERSION =
          
        </dt>
        <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.1</span><span class='tstring_end'>&quot;</span></span></pre></dd>
      
    </dl>
  







  
    <h2>
      Class Method Summary
      <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
    </h2>

    <ul class="summary">
      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#browse-class_method" title="browse (class method)">+ (Array) <strong>browse</strong>(browse_params = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Browse the website without authentication.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#browse_featured-class_method" title="browse_featured (class method)">+ (Array) <strong>browse_featured</strong>(browse_params = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Gets the latest featured mods on the site.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#browse_recent-class_method" title="browse_recent (class method)">+ (Array) <strong>browse_recent</strong>(browse_params = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Gets the newest mods on the site.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#browse_top-class_method" title="browse_top (class method)">+ (Array) <strong>browse_top</strong>(browse_params = {}) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Gets the most popular mods on the site.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_https_response-class_method" title="get_https_response (class method)">+ (Object) <strong>get_https_response</strong>(url) </a>
    

    
  </span>
  
  
  
  
  
  
  <span class="private note title">private</span>

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_json-class_method" title="get_json (class method)">+ (Object) <strong>get_json</strong>(url) </a>
    

    
  </span>
  
  
  
  
  
  
  <span class="private note title">private</span>

  
    <span class="summary_desc"><div class='inline'></div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_latest_mod_version-class_method" title="get_latest_mod_version (class method)">+ (ModVersion) <strong>get_latest_mod_version</strong>(id) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Retrieves the latest version of the specified mod.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_mod-class_method" title="get_mod (class method)">+ (Mod) <strong>get_mod</strong>(id) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Retrieves the specified mod information.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#get_user-class_method" title="get_user (class method)">+ (User) <strong>get_user</strong>(username) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Retrieves the specified user information.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#search_mod-class_method" title="search_mod (class method)">+ (Array) <strong>search_mod</strong>(query) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Searches for mods with the specified keyword/phrase.</p>
</div></span>
  
</li>

      
        <li class="public ">
  <span class="summary_signature">
    
      <a href="#search_user-class_method" title="search_user (class method)">+ (Array) <strong>search_user</strong>(query) </a>
    

    
  </span>
  
  
  
  
  
  
  

  
    <span class="summary_desc"><div class='inline'>
<p>Searches for users with the specified keyword/phrase.</p>
</div></span>
  
</li>

      
    </ul>
  



  <div id="class_method_details" class="method_details_list">
    <h2>Class Method Details</h2>

    
      <div class="method_details first">
  <h3 class="signature first" id="browse-class_method">
  
    + (<tt>Array</tt>) <strong>browse</strong>(browse_params = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Browse the website without authentication.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>browse_params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>browses the website with the specified parameters</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>browse_params</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:page</span>
          <span class="type">(<tt>Integer</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>which page of results to retrieve. Valid values: 1-??? (optional)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:orderby</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>which property of mod use for ordering. Valid values are: name, updated,
created. Default: created (required)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:order</span>
          <span class="type">(<tt>String</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>which ordering direction to use. Valid values are: asc, desc. Default: asc
(required)</p>
</div>
          
        </li>
      
        <li>
          <span class="name">:count</span>
          <span class="type">(<tt>Fixnum</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>which count of mods to show per page. Valid values are: 1-500. Default: 30
(required)</p>
</div>
          
        </li>
      
    </ul>
  

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>an array containing the results found.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is not an Integer</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is 0</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “orderby” is not “name”, “updated” or “created”</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “order” is not “asc” or “desc”</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “count” is 0 or greater than 500</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if not all parameters are present</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 129</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_browse'>browse</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_params'>browse_params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:page</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	<span class='id identifier rubyid_orderby'>orderby</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:orderby</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>orderby</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	<span class='id identifier rubyid_order'>order</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:order</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>order</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	<span class='id identifier rubyid_count'>count</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:count</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>count</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span>
		<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page must be an Integer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for page. valid values: 1-???</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>&gt;</span> <span class='int'>0</span>
	<span class='kw'>end</span>
	
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>orderby must be a String</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_orderby'>orderby</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>order must be a String</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>count must be a Fixnum</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_count'>count</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Fixnum</span><span class='rparen'>)</span>
	
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for orderby. valid values: name, updated, created</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_orderby'>orderby</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>name</span><span class='tstring_end'>&quot;</span></span> <span class='op'>||</span> <span class='id identifier rubyid_orderby'>orderby</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>updated</span><span class='tstring_end'>&quot;</span></span> <span class='op'>||</span> <span class='id identifier rubyid_orderby'>orderby</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>created</span><span class='tstring_end'>&quot;</span></span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for order. valid values are: asc, desc</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>asc</span><span class='tstring_end'>&quot;</span></span> <span class='op'>||</span> <span class='id identifier rubyid_order'>order</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>desc</span><span class='tstring_end'>&quot;</span></span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for count. valid values are: 1-500</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_count'>count</span> <span class='op'>&gt;</span> <span class='int'>0</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_count'>count</span> <span class='op'>&lt;</span> <span class='int'>500</span>
	
	<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/browse</span><span class='tstring_end'>&quot;</span></span>
	
	<span class='comment'># Check if the page argument is included. If it isn't, then we don't need it to browse the mods.
</span>	<span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_orderby'>orderby</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_order'>order</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_count'>count</span>
		<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rbrace'>}</span><span class='tstring_content'>?page=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_page'>page</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;orderby=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_orderby'>orderby</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;order=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_order'>order</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;count=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_count'>count</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
		
		<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_mod_json'>mod_json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>result</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
		<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>elsif</span> <span class='id identifier rubyid_orderby'>orderby</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_order'>order</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_count'>count</span>
		<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rbrace'>}</span><span class='tstring_content'>?orderby=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_orderby'>orderby</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;order=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_order'>order</span><span class='rbrace'>}</span><span class='tstring_content'>&amp;count=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_count'>count</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
		
		<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_mod_json'>mod_json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>result</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
		<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>else</span>
		<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Missing browse parameter(s)</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_orderby'>orderby</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_order'>order</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_count'>count</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="browse_featured-class_method">
  
    + (<tt>Array</tt>) <strong>browse_featured</strong>(browse_params = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Gets the latest featured mods on the site</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>browse_params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>browses the website with the specified parameters</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>browse_params</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:page</span>
          <span class="type">(<tt>Integer</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>which page of results to retrieve. Valid values: 1-??? (optional)</p>
</div>
          
        </li>
      
    </ul>
  

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>an array containing the newest mods on the site.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is not an Integer</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is 0</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 224</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_browse_featured'>browse_featured</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_params'>browse_params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:page</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page must be an Integer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for page. valid values: 1-???</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>&gt;</span> <span class='int'>0</span>
	
	<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/browse/featured</span><span class='tstring_end'>&quot;</span></span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span>
		<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rbrace'>}</span><span class='tstring_content'>?page=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_page'>page</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
		
		<span class='id identifier rubyid_mod_json'>mod_json</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>else</span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>

		<span class='id identifier rubyid_mod_json'>mod_json</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="browse_recent-class_method">
  
    + (<tt>Array</tt>) <strong>browse_recent</strong>(browse_params = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Gets the newest mods on the site</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>browse_params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>browses the website with the specified parameters</p>
</div>
      
    </li>
  
</ul>

  
    
    
    <p class="tag_title">Options Hash (<tt>browse_params</tt>):</p>
    <ul class="option">
      
        <li>
          <span class="name">:page</span>
          <span class="type">(<tt>Integer</tt>)</span>
          <span class="default">
            
          </span>
          
            &mdash; <div class='inline'>
<p>which page of results to retrieve. Valid values: 1-??? (optional)</p>
</div>
          
        </li>
      
    </ul>
  

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>an array containing the newest mods on the site.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is not an Integer</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is 0</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 187</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_browse_recent'>browse_recent</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_params'>browse_params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:page</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page must be an Integer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for page. valid values: 1-???</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>&gt;</span> <span class='int'>0</span>
	
	<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/browse/new</span><span class='tstring_end'>&quot;</span></span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span>
		<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rbrace'>}</span><span class='tstring_content'>?page=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
		
		<span class='id identifier rubyid_mod_json'>mod_json</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>else</span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
		
		<span class='id identifier rubyid_mod_json'>mod_json</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="browse_top-class_method">
  
    + (<tt>Array</tt>) <strong>browse_top</strong>(browse_params = {}) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Gets the most popular mods on the site</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>browse_params</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
        <em class="default">(defaults to: <tt>{}</tt>)</em>
      
      
        &mdash;
        <div class='inline'>
<p>browses the website with the specified parameters</p>
</div>
      
    </li>
  
    <li>
      
        <span class='name'>[Integer]</span>
      
      
        <span class='type'>(<tt>Hash</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>a customizable set of options</p>
</div>
      
    </li>
  
</ul>

  
    
    

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>an array containing the newest mods on the site.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is not an Integer</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “page” is 0</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 261</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_browse_top'>browse_top</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_params'>browse_params</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_page'>page</span> <span class='op'>=</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='symbol'>:page</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='id identifier rubyid_browse_params'>browse_params</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
	
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>page must be an Integer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>invalid value specified for page. valid values: 1-???</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_page'>page</span> <span class='op'>&gt;</span> <span class='int'>0</span>
	
	<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/browse/top</span><span class='tstring_end'>&quot;</span></span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_page'>page</span>
		<span class='id identifier rubyid_browse_url'>browse_url</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rbrace'>}</span><span class='tstring_content'>?page=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_page'>page</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
		
		<span class='id identifier rubyid_mod_json'>mod_json</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>else</span>
		<span class='id identifier rubyid_mod_json'>mod_json</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_browse_url'>browse_url</span><span class='rparen'>)</span>
		<span class='id identifier rubyid_arr'>arr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>

		<span class='id identifier rubyid_mod_json'>mod_json</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_arr'>arr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		
		<span class='kw'>return</span> <span class='id identifier rubyid_arr'>arr</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_https_response-class_method">
  
    + (<tt>Object</tt>) <strong>get_https_response</strong>(url) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note private">
  <strong>This method is part of a private API.</strong>
  You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


15
16
17
18
19
20
21
22
23
24
25</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 15</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_https_response'>get_https_response</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
	<span class='ivar'>@url</span> <span class='op'>=</span> <span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='const'>URI</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_http'>http</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@url</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='ivar'>@url</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl'>use_ssl</span> <span class='op'>=</span> <span class='kw'>true</span>
	<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_verify_mode'>verify_mode</span> <span class='op'>=</span> <span class='const'>OpenSSL</span><span class='op'>::</span><span class='const'>SSL</span><span class='op'>::</span><span class='const'>VERIFY_NONE</span>
	
	<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='op'>::</span><span class='const'>Get</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@url</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='rparen'>)</span>
	
	<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_response'>response</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_json-class_method">
  
    + (<tt>Object</tt>) <strong>get_json</strong>(url) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    <p class="note private">
  <strong>This method is part of a private API.</strong>
  You should avoid using this method if possible, as it may be removed or be changed in the future.
</p>


  </div>
</div>
<div class="tags">
  

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


28
29
30
31
32
33
34
35
36
37
38
39
40
41</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 28</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='id identifier rubyid_get_https_response'>get_https_response</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_json'>json</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='rparen'>)</span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_json'>json</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
		<span class='kw'>if</span> <span class='id identifier rubyid_json'>json</span><span class='period'>.</span><span class='id identifier rubyid_has_key?'>has_key?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>error</span><span class='tstring_end'>'</span></span>
			<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>error</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_json'>json</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>reason</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span>
		<span class='kw'>else</span>
			<span class='kw'>return</span> <span class='id identifier rubyid_json'>json</span>
		<span class='kw'>end</span>
	<span class='kw'>else</span>
		<span class='kw'>return</span> <span class='id identifier rubyid_json'>json</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_latest_mod_version-class_method">
  
    + (<tt><span class='object_link'><a href="KerbalStuff/ModVersion.html" title="KerbalStuff::ModVersion (class)">ModVersion</a></span></tt>) <strong>get_latest_mod_version</strong>(id) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Retrieves the latest version of the specified mod.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>id</span>
      
      
        <span class='type'>(<tt>Integer</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the id of the mod to retrieve the latest version released.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="KerbalStuff/ModVersion.html" title="KerbalStuff::ModVersion (class)">ModVersion</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>A ModVersion object containing information about the version.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “id” is not an Integer</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


110
111
112
113
114</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 110</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_latest_mod_version'>get_latest_mod_version</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentException</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>id must be an Integer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
	
	<span class='kw'>return</span> <span class='const'>ModVersion</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/mod/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='rbrace'>}</span><span class='tstring_content'>/latest</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_mod-class_method">
  
    + (<tt><span class='object_link'><a href="KerbalStuff/Mod.html" title="KerbalStuff::Mod (class)">Mod</a></span></tt>) <strong>get_mod</strong>(id) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Retrieves the specified mod information.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>id</span>
      
      
        <span class='type'>(<tt>Integer</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the id of the mod to retrieve information for.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="KerbalStuff/Mod.html" title="KerbalStuff::Mod (class)">Mod</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>A Mod object containing the information about the mod.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “id” is not an Integer</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


86
87
88
89
90</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 86</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_mod'>get_mod</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>id must be an Integer</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_id'>id</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Integer</span><span class='rparen'>)</span>
	
	<span class='kw'>return</span> <span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/mod/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_id'>id</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="get_user-class_method">
  
    + (<tt><span class='object_link'><a href="KerbalStuff/User.html" title="KerbalStuff::User (class)">User</a></span></tt>) <strong>get_user</strong>(username) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Retrieves the specified user information.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>username</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the username of the user to retrieve information for.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt><span class='object_link'><a href="KerbalStuff/User.html" title="KerbalStuff::User (class)">User</a></span></tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>A User object containing the information about the user.</p>
</div>
      
    </li>
  
</ul>
<p class="tag_title">Raises:</p>
<ul class="raise">
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “username” is not a String</p>
</div>
      
    </li>
  
    <li>
      
      
        <span class='type'>(<tt>ArgumentError</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>if “username” is empty</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


98
99
100
101
102
103</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 98</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_get_user'>get_user</span><span class='lparen'>(</span><span class='id identifier rubyid_username'>username</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>username must be a String</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_username'>username</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>username cannot be an empty string</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_username'>username</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>&gt;</span> <span class='int'>0</span>
	
	<span class='kw'>return</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/user/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_username'>username</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="search_mod-class_method">
  
    + (<tt>Array</tt>) <strong>search_mod</strong>(query) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Searches for mods with the specified keyword/phrase.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>query</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the keyword/phrase to search for.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>An array containing the results found. If no result was found, will return
a String.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


47
48
49
50
51
52
53
54
55
56
57
58
59
60</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 47</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_search_mod'>search_mod</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/search/mod?query=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
	
	<span class='id identifier rubyid_resArr'>resArr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>0</span>
		<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No results were found for '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='rbrace'>}</span><span class='tstring_content'>'.</span><span class='tstring_end'>&quot;</span></span>
	<span class='kw'>else</span>
		<span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_mod'>mod</span><span class='op'>|</span>
			<span class='id identifier rubyid_resArr'>resArr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>Mod</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_mod'>mod</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		<span class='kw'>return</span> <span class='id identifier rubyid_resArr'>resArr</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
      <div class="method_details ">
  <h3 class="signature " id="search_user-class_method">
  
    + (<tt>Array</tt>) <strong>search_user</strong>(query) 
  

  

  
</h3><div class="docstring">
  <div class="discussion">
    
<p>Searches for users with the specified keyword/phrase.</p>


  </div>
</div>
<div class="tags">
  <p class="tag_title">Parameters:</p>
<ul class="param">
  
    <li>
      
        <span class='name'>query</span>
      
      
        <span class='type'>(<tt>String</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>the keyword/phrase to search for.</p>
</div>
      
    </li>
  
</ul>

<p class="tag_title">Returns:</p>
<ul class="return">
  
    <li>
      
      
        <span class='type'>(<tt>Array</tt>)</span>
      
      
      
        &mdash;
        <div class='inline'>
<p>An array containing the results found. If no result was found, will return
a String.</p>
</div>
      
    </li>
  
</ul>

</div><table class="source_code">
  <tr>
    <td>
      <pre class="lines">


66
67
68
69
70
71
72
73
74
75
76
77
78
79</pre>
    </td>
    <td>
      <pre class="code"><span class="info file"># File 'lib/KerbalStuff.rb', line 66</span>

<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_search_user'>search_user</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
	<span class='id identifier rubyid_res'>res</span> <span class='op'>=</span> <span class='id identifier rubyid_get_json'>get_json</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>https://kerbalstuff.com/api/search/user?query=</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
	
	<span class='id identifier rubyid_resArr'>resArr</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
	
	<span class='kw'>if</span> <span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>==</span> <span class='int'>0</span>
		<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No results were found for '</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='rbrace'>}</span><span class='tstring_content'>'.</span><span class='tstring_end'>&quot;</span></span>
	<span class='kw'>else</span>
		<span class='id identifier rubyid_res'>res</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_user'>user</span><span class='op'>|</span>
			<span class='id identifier rubyid_resArr'>resArr</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_user'>user</span><span class='rparen'>)</span><span class='rparen'>)</span>
		<span class='kw'>end</span>
		<span class='kw'>return</span> <span class='id identifier rubyid_resArr'>resArr</span>
	<span class='kw'>end</span>
<span class='kw'>end</span></pre>
    </td>
  </tr>
</table>
</div>
    
  </div>

</div>

    <div id="footer">
  Generated on Wed Dec 10 18:44:27 2014 by
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
  0.8.7.6 (ruby-1.9.3).
</div>

  </body>
</html>